package com.company;

import java.sql.*;

public class Main {

    public static void main(String[] args) throws Exception {
	// write your code here
        Class.forName("com.mysql.jdbc.Driver");
        Connection con = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/student", "root", "root");
        Statement stat = con.createStatement();
        String sql = "Select*from stu";
        ResultSet rs = stat.executeQuery(sql);
        while (rs.next()) {
            System.out.println(rs.getInt("id") + "\t" + rs.getString("name"));
        }
        con.close();;
        stat.close();
        rs.close();
    }
}
